class User { 
	String login
	String name
	String email
	String password
	String confirm
	
	public String getLogin(){
		return this.login
	}
	public void setLogin(String newLogin){
		this.login = newLogin
	}
	public String getName(){
		return this.name
	}
	public void setName(String newName){
		this.name = newName
	}
	public String getEmail(){
		return this.email
	}
	public void setEmail(String newEmail){
		this.email = newEmail
	}	
	public String getPassword(){
		return this.password
	}
	public void setPassword(String newPassword){
		this.password = newPassword
	}			
	
//	static hasMany = [loanings:Loaning]
	
	static transients = [ "confirm" ]
	
    static constraints = {
        login(blank:false, unique:true)
		name(blank:false)
		password(blank:false, nullable:false, validator: { val, obj ->
        	if (val.size() < 6){
            	return ['not.valid.password']
        	}
 		})
		email(blank:false)
		confirm(nullable:true)
    }
    
    public boolean myValidate(){
		if (this.login == "") return false
		if (this.login == null) return false
		if (this.name == "") return false
		if (this.name == null) return false
		if (this.email == "") return false
		if (this.email == null) return false
		if (this.password == "") return false
		if (this.password == null) return false		
		return true
    }	
}	
